package edu.nctu.csie.jichang.database.create;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import edu.nctu.csie.jichang.database.util.DateUtil;



public class ValueFactory {
	
	public static final String[] randomString  = new String[]{"A","B","C","D","E","F","G","H","I","J"};
	public static final int		 randomInteger = randomString.length;
	
	public static Map<String,Map<String,Object[]>> allowMaps = new HashMap<String,Map<String,Object[]>>();

	static{
		init_c_tag();
	}
	
	public static void init_c_tag(){
		Map<String,Object[]> tAllowAry = new HashMap<String, Object[]>();
		tAllowAry.put("_special_action", new Integer[]{0,1,2});
		tAllowAry.put("_attribute",new String[]{"DO", "DI", "AO", "AI"});
		tAllowAry.put("_model",new Integer[]{0,1,2});
		tAllowAry.put("_status", new Integer[]{-1,0,1,2});
		allowMaps.put("c_tag", tAllowAry);
	}
	
	public static boolean isHasAllowValue(String pTableName){
		return allowMaps.containsKey(pTableName);
	}

	public static Map<String,Object[]> getAllowValue(String pTableName){
		return allowMaps.get(pTableName);
	}

	public static Date getRandomDate() {
		return DateUtil.getDate();
	}

	public static int getRandomInteger() {
		return (int)(Math.random()*randomInteger);
	}

	public static String getRandomString() {
		return randomString[getRandomInteger()];
	}
}
